<?php
$oUsers = UserHandler::getUsers();
$iMission = (@$iMission ? $iMission : $_REQUEST['iMission']);
?>
<td class="clear" colspan="3">
	<table cellspacing="0">
<?php
$i = 0;
$oNotes = NoteHandler::getNotes($_SESSION['iJobID'], $iMission);
foreach ($oNotes as $oThisNote) {
	$sNoteBody = $oThisNote->sBody;
	if (!$oThisNote->bUseHTML) {
		$sNoteBody = str_replace('<', '&lt;', str_replace('>', '&gt;', $sNoteBody));
	}
	$sNoteBody = stripslashes(nl2br(str_replace(' ', '&nbsp;', wordwrap($sNoteBody))));
	?>
		<tr>
			<td class="note small center" style="vertical-align: top;">
				<a href="javascript: showBox('note-delete', 'iMissionID=<?php print $iMission ?>&iNoteID=<?php print $oThisNote->iID ?>');"><img src="images/<?php print $_SESSION['oUserVars']['images'] ?>/note-delete.png" border="0"></a>
				<a href="javascript: showBox('note-change', 'iMissionID=<?php print $iMission ?>&iNoteID=<?php print $oThisNote->iID ?>');"><img src="images/<?php print $_SESSION['oUserVars']['images'] ?>/note-change.png" border="0"></a>
	<?php
	if ($i++ == 0 && JobHandler::canDo('mission', 'write')) {
		?>
				<a href="javascript: showBox('note-add', 'iMissionID=<?php print $iMission ?>');"><img src="images/<?php print $_SESSION['oUserVars']['images'] ?>/note-add.png" border="0"></a>
		<?php
	}
	?>
			</td>
			<td class="note small center" style="vertical-align: top;">
				<?php print coolDate($oThisNote->iTiming, true, true) ?>
			</td>
			<td class="note small" style="vertical-align: top;"><a href="index.php?sView=user-view&iUser=<?php print $oThisNote->iUser ?>"><?php print $oUsers[$oThisNote->iUser]->sUser ?></a>:<br><?php print $sNoteBody ?></td>
		</tr>
	<?php
}
?>
	</table>
</td>

